<template>
    <el-dialog
        class="dialog"
        title="重置密码"
        :visible.sync="isShow"
        :close-on-click-modal="false"
        @close="onDialogCloseBefore"
    >
        <el-form
            ref="form"
            label-width="auto"
            class="form"
            :model="formData"
            :rules="rules"
        >
  
            <el-form-item label="代理商名称:" prop="agent_name">
                <el-input
                    v-model="formData.agent_name"
                    clearable
                    maxlength="10"
                    placeholder="请输入代理商名称"
                    :disabled="isEdit"
                ></el-input>
            </el-form-item>


            <el-form-item label="登录帐号:" prop="phone">
                <el-input
                    v-model="formData.phone"
                    placeholder="请输入登录帐号"
                    :disabled="isEdit"
                ></el-input>
            </el-form-item>
            
            <el-form-item label="登录密码:" prop="agent_password"   >
                <el-input
                    v-model="formData.agent_password"
                    placeholder="请输入登录密码"
                ></el-input>
            </el-form-item>
        </el-form>
        <div slot="footer">
            <el-button @click="onDialogClose">取 消</el-button>
            <el-button class="btn-confirm" @click="onSubmit">确 定</el-button>
        </div>
    </el-dialog>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import { Action } from "vuex-class";
import { mixinDialogForm } from "@/mixin/dialog/Form";

@Component({
    name: "agentRePwd",
    mixins: [mixinDialogForm]
})
export default class agentRePwd extends Vue {
    @Action("purviewAgent/repwd") itemEdit: any;
    editInit(data: any) {
        const me = this as any;
        data.agent_name = data.agent_name.toString();
        data.phone = data.phone.toString();
        me.formData = Object.assign({}, me.formData, data);
    }
    formData: any = {
        agent_sn: "",
        user_sn: "",
        agent_password: ""
    };

   
    // 表单验证
    rules: any = {
        agent_sn: [
            {
                required: true,
                message: "请选择代理商"
            }
        ],
        agent_password: [
            {
                required: true,
                message: "请输入新密码"
            }
        ]
    };
}
</script>